package com.ecoolex.ying.space.admin.controller;

import org.apache.dubbo.config.annotation.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ecoolex.ying.space.ws.PaymentOrderService;

@RestController
@RequestMapping("/payment/order")
public class PaymentOrderController {

	private Logger log = LoggerFactory.getLogger(PaymentOrderController.class);
	
	@Reference
	private PaymentOrderService paymentOrderService;
	
	@PostMapping("/notify/pay")
    public Object payNotify(@RequestBody String body) {
        log.debug("支付通知[/payment/order/notify/pay]: body={}", body);
        return paymentOrderService.orderNotify(body, PaymentOrderController.class.getSimpleName());
    }
	
	@PostMapping("/notify/refund")
    public Object refundNotify(@RequestBody String body) {
        log.debug("退款通知[/payment/order/notify/refund]: body={}", body);
        return paymentOrderService.orderNotify(body, PaymentOrderController.class.getSimpleName());
    }
}
